Skip to content

Conversation

@pulsovi
Copy link
Contributor

@pulsovi pulsovi commented Mar 10, 2024

New: Enhance API endpoint to support additional filters

Resolves #7484

Description

Enhances the Give\Donations\Endpoints\ListDonations API endpoint to support additional filters, providing the necessary hooks for compatibility with third party add-ons / snippets.

The main goal is to extend the flexibility of the Donations\ListTable in the admin interface, allowing for the integration of new filters, such as filtering donations by donor ID.

Affects

Admin List Tables

Visuals

N/A

Testing Instructions

Tests already included in PR : see tests/Unit/Donations/Endpoints/TestListDonations:testShouldAllowAddingFilters

To test the new hooks and extension points, add some JavaScript code on the front-end page (via a snippet):

document.addEventListener("DOMContentLoaded", () => {
    wp.hooks.addFilter('give-donations-list-table-filters', 'namespace', filters => {
        return [
            ...filters,
            {
                name: 'donor',
                type: 'search',
                text: 'Donor',
                ariaLabel: 'Search by Donor'
            },
        ];
    });
});

Go to the back office > Give > Donations, new filter input added for Donor ID, lastname or firstname.

To allow using filters that are not already managed by ListDonations

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • [-] Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@github-actions
Copy link

This PR is stale because it has been open 45 days with no activity. Stale PRs will NOT be automatically closed.

@github-actions github-actions bot added the Stale label Apr 25, 2024
@github-actions github-actions bot removed the Stale label Aug 5, 2024
@pulsovi pulsovi force-pushed the filter/make-list_table-extendable branch from 3579553 to b4f5184 Compare August 5, 2024 13:05
@pulsovi pulsovi marked this pull request as draft August 9, 2024 09:07
@pulsovi pulsovi changed the title New Feat: Admin List Tables - allow third party plugin to add filters New: Enhance API endpoint to support additional filters Aug 9, 2024
@pulsovi pulsovi force-pushed the filter/make-list_table-extendable branch from b6d9e43 to eeac823 Compare August 9, 2024 11:57
@pulsovi pulsovi marked this pull request as ready for review August 9, 2024 12:00
@github-actions
Copy link

This PR is stale because it has been open 45 days with no activity. Stale PRs will NOT be automatically closed.

@github-actions github-actions bot added the Stale label Oct 24, 2024
@github-actions github-actions bot removed the Stale label Mar 15, 2025
@github-actions
Copy link

This PR is stale because it has been open 45 days with no activity. Stale PRs will NOT be automatically closed.

@github-actions github-actions bot added the Stale label Apr 29, 2025
@jonwaldstein
Copy link
Contributor

Hey @pulsovi 👋

This is a really cool idea! Unfortunately its been a couple years and the PR review was never prioritized by our team - so its gotten out of sync with the main branch. We've also made some updates to the endpoint and UI over time. I think at this point it will be better to close this and use as inspiration for a new PR that is more in sync with our current branch.

Since we're such a small team, I would also suggest keeping the PR as small as possible or else it can be overwhelming to review as we have lots of internal priorities to manage.

We really appreciate your contributions and hope we can collaborate on some new solutions 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance API endpoint to support additional filters

2 participants